<section class="content-header" >
    <h1>
        会员积分
        <small>积分列表</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="{:U('/Admin/index')}"><i class="fa fa-home"></i>首页</a></li>
        <li class="active">会员积分</li>
    </ol>
</section>
<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <div class="box-title"><label >会员积分</label></div>
                    <div class="pull-right">
                        <button class="btn btn-block btn-primary btn-sm" onclick="addMember()"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;添加会员</button>
                    </div>
                </div><!-- /.box-header -->
                <div class="box-body">
                    <table id="table" class="table table-bordered " width="100%">
                        <thead>
                            <tr>
                                <th>姓名</th>
                                <th>手机号</th>
                                <th>积分</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                    </table>
                </div><!-- /.box-body -->
            </div><!-- /.box -->
        </div><!-- /.col -->
    </div><!-- /.row -->
</section><!-- /.content -->
<!-- DATA TABES SCRIPT -->
<!-- page script -->
<script type="text/javascript">
    $(function () {
        $('#table').dataTable({
//            "searching": false,
            "processing": true, //载入数据的时候是否显示“载入中”
//            ordering: false, //排序操作在服务端进行，所以可以关了。
            'serverSide': true,
            "ajax": "{:U('member/integral_list')}",
            "order": [2,'desc'],
            "columns": [
                {"data": "name","orderable": false},
                {"data": "mobile","orderable": false},
                {"data": "integral"},
                {"data": "oper","orderable": false}
            ],
            "language": lang
        });
    });
    function uptateItem(id) {
        var dialogPage = dialog({
            id: 'dialogPage',
            "title": '修改会员信息',
            "width": '42em',
            padding: 0,
            zIndex: 1049
        });
        $.ajax({
            url: "{:U('member/updateData')}",
            data: "id=" + id,
            success: function (html) {
                dialogPage.content(html);
                dialogPage.show();
                $('#close-dialog').click(function () {
                    dialogPage.close().remove();
                });
            }
        });
    }

    function deleteItem(id) {
        $.messager.confirm('确认删除', '确认要删除会员？', function () {
            $.ajax({
                url: "{:U('member/deleteData')}",
                data: "id=" + id,
                success: function (json) {
                    if (!json.status) {
                        dialog({
                            "title": '提示信息',
                            "width": '20em',
                            'content': json.info
                        }).show();
                    } else {
                        dialog({
                            "title": '提示信息',
                            "width": '20em',
                            'content': json.info
                        }).show();
                    }
                    reloadContent();
                }
            });
        });

    }

    function addMember() {
        var dialogPage = dialog({
            id: 'dialogPage',
            "title": '添加会员',
            "width": '32em',
            padding: 0,
            zIndex: 1049
        });
        $.ajax({
            url: "{:U('member/add')}",
            success: function (html) {
                dialogPage.content(html);
                dialogPage.show();
                $('#close-dialog').click(function () {
                    dialogPage.close().remove();
                });
            }
        });
    }
</script>